package com.example.day09;

import com.example.day10.DBCPDatasource;
import com.mysql.jdbc.Driver;

import java.sql.*;

public class Select {
    public static void main(String[] args) throws SQLException {
        new Driver();
        Connection connection = DBCPDatasource.getConnection();
        String sql = "SELECT * FROM db_test.student";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        ResultSet resultSet = preparedStatement.executeQuery();
        while (resultSet.next()) {
            System.out.println(resultSet.getString("name") + resultSet.getInt("age"));
        }
    }
}